package com.java.reflect;

public class Reflect02_User {
    public static void main(String[] args) throws Exception {
        // Class对象回去
        User user1 = new User(1,"name01") ;
        Class userClass1 = user1.getClass() ;
        Class userClass2 = Class.forName("com.java.reflect.User");
        Class userClass3 = User.class ;
        System.out.println(User.class.getName());
        System.out.println("userClass1==userClass2?"+(userClass1==userClass2));
        System.out.println("userClass2==userClass3?"+(userClass2==userClass3));
        // 类型创建和判断
        Object object = User.class.newInstance() ;
        System.out.println("类型："+(object instanceof User));
        System.out.println("类型："+(userClass3.isInstance(user1)));
    }
}
